package com.qk.management.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author diva
 * @date 2025/10/8 18:21
 * @ProjectName
 */
@Mapper
public interface RoleMapper {
    @Select("SELECT id, name, label, remark, create_time, update_time FROM role")
    List<Role> selectAll();

    Integer count(@Param("name") String name,
                  @Param("label") String label,
                  @Param("remark") String remark);

    List<Role> selectByPage(@Param("name") String name,
                            @Param("label") String label,
                            @Param("remark") String remark,
                            @Param("offset") Integer offset,
                            @Param("pageSize") Integer pageSize);
    @Insert("insert into role(name,label,remark,create_time,update_time) values(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void insert(Role role);
    @Delete("delete from role where id=#{id}")
    void deleteById(Integer id);
    @Select("SELECT id, name, label, remark, create_time, update_time FROM role WHERE id = #{id}")
    Role selectById(Integer id);

    void update(Role role);
    @Select("select * from role where label = #{roleLabel}")
    Role selectByRoleLabel(String roleLabel);
}
